import request from '@/utils/request'
import { resolveComponent } from 'vue'

/** 主机故障注入 **/
//主机地址
export function onlineHost(query) {
    return request({
        url: '/base/getConnectIp',
        method: 'get',
        params: query
    })
}

//获取磁盘目录
export function getDiskList(query) {
    return request({
        url: '/hostFaultInject/getDirectoryByIp',
        method: 'get',
        params: query
    })
}

//CPU负载故障注入
export function hostCpuExec(data) {
    return request({
        url: '/hostFaultInject/getCPULoadResult',
        method: 'post',
        data: data
    })
}

//磁盘读写IO故障注入
export function hostDiskIOExec(data) {
    return request({
        url: '/hostFaultInject/getDiskBurnResult',
        method: 'post',
        data: data
    })
}

//磁盘填充故障注入
export function hostDiskFillExec(data) {
    return request({
        url: '/hostFaultInject/getDiskFillResult',
        method: 'post',
        data: data
    })
}

//内存填充故障注入
export function hostMemoryFillExec(data) {
    return request({
        url: '/hostFaultInject/getMemLoadResult',
        method: 'post',
        data: data
    })
}

//主机停止
export function hostStop(query) {
    return request({
        url: '/base/stopHostCmd',
        method: 'get',
        params: query
    })
}

//获取主机执行列表
export function hostFaultInjectResult(query) {
    return request({
        url: '/base/getHostFaultInjectResult',
        method: 'get',
        params: query
    })
}

/** 网络故障注入 **/
//获取网卡设备列表
export function interfaceList(query) {
    return request({
        url: '/ipList/getNetworkCards',
        method: 'get',
        params: query
    })
}

//获取网络执行列表
export function networkFaultInjectResult(query) {
    return request({
        url: '/base/getNetworkFaultInjectResult',
        method: 'get',
        params: query
    })
}

//网络延迟故障注入
export function networkDelayFaultInject(data) {
    return request({
        url: '/networkFaultInject/getDelayResult',
        method: 'post',
        data: data
    })
}

//篡改DNS域名解析
export function networkDNSFaultInject(data) {
    return request({
        url: '/networkFaultInject/getDNSResult',
        method: 'post',
        data: data
    })
}

//网络丢包故障注入
export function networkLossFaultInject(data) {
    return request({
        url: '/networkFaultInject/getLossResult',
        method: 'post',
        data: data
    })
}

//网络包损坏故障注入
export function networkCorruptFaultInject(data) {
    return request({
        url: '/networkFaultInject/getCorruptResult',
        method: 'post',
        data: data
    })
}

//网络包乱序故障注入
export function networkReorderFaultInject(data) {
    return request({
        url: '/networkFaultInject/getReorderResult',
        method: 'post',
        data: data
    })
}

//网络包重复故障注入
export function networkDuplicateFaultInject(data) {
    return request({
        url: '/networkFaultInject/getDuplicateResult',
        method: 'post',
        data: data
    })
}

//本地端口占用故障注入
export function networkOccupyFaultInject(data) {
    return request({
        url: '/networkFaultInject/getOccupyResult',
        method: 'post',
        data: data
    })
}

//停止
export function networkStop(query) {
    return request({
        url: '/base/stopNetworkCmd',
        method: 'get',
        params: query
    })
}

/** 进程/脚本故障注入 **/
//获取进程/脚本执行列表
export function processAndScriptFaultInjectResult(query) {
    return request({
        url: '/base/getProcessAndScriptFaultInjectResult',
        method: 'get',
        params: query
    })
}

//进程终结故障注入
export function processKillResult(data) {
    return request({
        url: '/processAndScriptFaultInject/getProcessKillResult',
        method: 'post',
        data: data
    })
}

//进程暂停故障注入
export function processStopResult(data) {
    return request({
        url: '/processAndScriptFaultInject/getProcessStopResult',
        method: 'post',
        data: data
    })
}

//脚本函数延时故障注入
export function scriptDelayResult(data) {
    return request({
        url: '/processAndScriptFaultInject/getScriptDelayResult',
        method: 'post',
        data: data
    })
}

//脚本退出故障注入
export function scriptExitResult(data) {
    return request({
        url: '/processAndScriptFaultInject/getScriptExitResult',
        method: 'post',
        data: data
    })
}

//停止
export function processAndScriptStop(query) {
    return request({
        url: '/base/stopProcessAndScriptCmd',
        method: 'get',
        params: query
    })
}

//查询脚本名
export function checkProcessName(query) {
    return request({
        url: '/processAndScriptFaultInject/checkProcessName',
        method: 'get',
        params: query
    })
}

/** 数据库故障注入 **/
//获取数据库故障执行列表
export function getDatabaseFaultInjectResult(query) {
    return request({
        url: '/base/getDatabaseFaultInjectResult',
        method: 'get',
        params: query
    })
}

//数据库延时故障注入
export function mysqlDelayResult(data) {
    return request({
        url: '/databaseFaultInject/getMysqlDelayResult',
        method: 'post',
        data: data
    })
}

//数据库异常故障注入
export function mysqlThrowCustomExceptionResult(data) {
    return request({
        url: '/databaseFaultInject/getMysqlThrowCustomExceptionResult',
        method: 'post',
        data: data
    })
}

//停止
export function stopDatabaseCmd(query) {
    return request({
        url: '/base/stopDatabaseCmd',
        method: 'get',
        params: query
    })
}